# Django settings for series project.

# importo os para generar el path
import os

# genero el path general y el de media
DIR = os.path.dirname(__file__)
MEDIA_DIR  = os.path.join(DIR, 'media')

# indico debug
DEBUG = True
TEMPLATE_DEBUG = DEBUG

# esto es para el multiidioma
ugettext = lambda s: s 

ADMINS = (
    ('Alejandro', 'alejandro@pexego.es'),
)

MANAGERS = ADMINS

DATABASES = {
    'default': {
        'ENGINE': '', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': '',                      # Or path to database file if using sqlite3.
        'USER': '',                      # Not used with sqlite3.
        'PASSWORD': '',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
    }
}

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'Europe/Madrid'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'es'

LANGUAGES = (  
    ('es', ugettext('Castellano')),
    ('en', ugettext('English')),
    
)

LANGUAGE_COOKIE_NAME='django_language'

SITE_ID = 2

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = MEDIA_DIR

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = '/media/'

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/media/admin/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'kj&b0v(*mzfl%+2__pb)+*-8)x-*9-e7it3v+s1%7i6q%%x+a0'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
    #'django.template.loaders.eggs.Loader',
)

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    #'/home/alejandro/prueba/series/templates',
    os.path.join(os.path.dirname(__file__), 'templates'),    
)


MIDDLEWARE_CLASSES = (    
        'django.contrib.sessions.middleware.SessionMiddleware',
        'django.contrib.auth.middleware.AuthenticationMiddleware',
        'django.middleware.common.CommonMiddleware',
        'django.middleware.locale.LocaleMiddleware',
        'django.contrib.messages.middleware.MessageMiddleware',
        'django.contrib.csrf.middleware.CsrfMiddleware',
        'pagination.middleware.PaginationMiddleware',
)

TEMPLATE_CONTEXT_PROCESSORS = (
        "django.core.context_processors.auth",
        "django.core.context_processors.debug",
        "django.core.context_processors.i18n",
        "django.core.context_processors.media",
        "django.core.context_processors.request"
)

ROOT_URLCONF = 'urls'

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.admin',
    'django.contrib.comments',
    'pagination',
    'transmeta',
    'haystack',
    'rosetta',
    'seriesapp',
)

# Caralladas del buscador
HAYSTACK_SITECONF = 'seriesapp.search_sites'
HAYSTACK_INCLUDE_SPELLING = True # True o False
HAYSTACK_SEARCH_RESULTS_PER_PAGE = 10 # Todo depende de este valor para paginar... curioso pero cierto.
HAYSTACK_DEFAULT_OPERATOR = 'AND' # Por defecto AND, pero se puede poner OR
HAYSTACK_SEARCH_ENGINE = 'whoosh'

HAYSTACK_WHOOSH_PATH = '/series_index/'
HAYSTACK_WHOOSH_STORAGE = 'file'
HAYSTACK_WHOOSH_POST_LIMIT = 256 * 1024 * 1024

# Paginador
PAGINATION_DEFAULT_PAGINATION = HAYSTACK_SEARCH_RESULTS_PER_PAGE-1